package com.android.support.lib.universal.views;

import android.app.Activity;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.android.support.lib.universal.utils.UtilProportion;


/**
 * Created by Administrator on 2017/5/21.
 */

public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
    private int space=30;

    public SpacesItemDecoration(Activity activity,int space) {
        this.space = (int) (space* UtilProportion.getInstance(activity).getHorizontalProportion());
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        super.getItemOffsets(outRect, view, parent, state);
        //设置RecyClerView子item项左右边距
        outRect.left = space;
        outRect.right = space;
    }
}
